package com.acane.instagram.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import java.util.List;

@Data
@TableName("post")
public class Post {
    private String id;
    private User user;
    private String userId;
    private String content;
    private int likeCount;
    private int commentCount;
    private List<String> urls;
    private String createdTime;
    private int status;
    private int isDeleted;

    @JsonProperty("shareRange")
    @Column(name = "share_range")
    private String shareRange;

    @JsonProperty("showRange")
    @Column(name = "show_range")
    private String showRange;
    private String thumbnailUrl;

    @ManyToMany
    @JoinTable(
            name = "post_tags",
            joinColumns = @JoinColumn(name = "post_id"),
            inverseJoinColumns = @JoinColumn(name = "tag_id")
    )
    private List<Tag> tags;
}
